Log In  
[back to top]

[ :: Read More :: ]

[8x8]

Was thinking of some things I'd like to see in future PICO. Reiterating the post as quite a bit has changed since its initial writing.

Some of these suggestions are possible, others are not. What are some of your suggestions that you think would be acceptable for the next update in Pico-8 ?

Going to start latest suggestions as replies to this thread as this one post has gotten rather large.

Here we go ! First off, 2 errors:

!! Fix parenthesis error. This gives error: IF (K=="(") X=X-1 ... gives error because parenthesis is character to check.

!! Fix error with modulos when using high negative numbers. ?-32767%10000 yields 7233, incorrect.

added 10-14-19 some carts Some carts use the keyboard reader and disable P so it's impossible to exit if you brought it up in SPLORE. Suggest you add additional keystroke of CTRL+P and/or CTRL+C to exit cart if run from Splore.

this may not be a good idea, I don't know. Consider removing number "type" entirely in favor of all variables being treated as strings. Naturally if math is to be considered, then they can be used as such. The advantage would be since strings essentially can be any size then numbers far exceeding 32767 would be possible, both to the left and right of the decimal point.

In splore, add folder that shows last carts played in order of time they are left up. The cart that is played the longest always appears at the top.So if the console shuts down accidentally, they can find the last game they played via this extra list.

added 10-11-19 undo is a little twitchy. Suggest that if a whole line is undone it does not immediately jump to the last line edited but stays with the current repaired line first - either that or when CTRL-Z is pressed, delete only 1-character at a time.

Suggest options turn on/off for particular cart to treat NIL as error. That is, if you said, A=B and b=nil it would crash in an error. Also suggest opposite, if string tries to equal nil you would get "" if number variables tries to equal nil you would get 0, so no error would ever happen with nil, and once again this would be optional.[/color]

Use "#" for hex and "$" for binary thus a=#b a would then contain a string of the hex value of b. a=!b a would then contain a string of the binary value of b. Sub is also accepted. a=#b(1) would mean that a contains the left-most character of the hex value of b. a=#b(2,4) would mean that a contains the 2nd and 4th characters of hex value of b.[/color]

Use ! as logical NOT. a=true a=!a a now contains false.

Add new option to PRINT, SPR, SSPR, RECT, LINE, CIRC, RECTFILL, and CIRCFILL. Maybe just use ROT() command. Rotate the next thing drawn at an angle ROT(a,b,c) where a is the angle and b is the focus. if b and c are not used, it rotates in the center of the drawing element. If not, then it just an arbitrary location based on B and C.

Have function to determine if a point is within other points, rectangle, hexagon, octagon, etc. isinarea[a] where is a 2-dimensional a[][] array that contains numbers of each point to the object in question.

added 10-07-19 some older languages made use of error catching and the ability to make use of ERR and ERL where ERR was the error message and ERL was the error line number where it occurred. Error catching is important in carts that might try to do math with a NIL value.

added 10-06-19 good suggestion by Xii to add ability to merge frame-drawing. That is, you can draw one frame and then draw another frame over it changing it from 60fps to 30fps but with the added benefit that both fields are blended, including colors. Thus, WHITE pixels on one page and black on the other yield GRAY final pixel result. Affects visual only. Reading the pixel back gives black were that the last color plotted.

added 09-28-19 add record array ability to graphic elements thus. points={circ(50,50,50)} so array points[] will now contain a 2D array that has every single point made in the drawing circle starting from the top. Same with spr(), sspr(), rect(), rectfill(), circfill(), line(), and even print(). And of course the element is not actually drawn at all.

added 09-27-19 add high speed distance formula, uses one integer and 2-arrays, a, b[], and c[]. A is return value. B and C are 2-dimensional array comprised of numbered items. Calling A=CLOSEST(B,C,D) the return value is the single number stored in that 2-dimensional array that is closest to index from a.

[8x8]

Here you can see in the example that there are 6 points. Let's label them:

objx=[] objy=[]
objx[0]=2 objy[0]=0
objx[1]=5 objy[1]=1
objx[2]=1 objy[2]=2
objx[3]=3 objy[3]=4
objx[4]=2 objy[4]=5
objx[5]=6 objy[5]=5

So we are checking to see which object is closest to #4

a=closest(4,objx,objy)

the return value will be 3 as this object is closest to it. Could also write FARTHEST() function.

In the sprite editor have CTRL = and SHIFT CTRL = turn on selection and expand it by one character in that direction.

In the map editor, show what flags are lit (the 8 colored buttons) when cursor is atop a sprite tile.

Option in Sprite Editor to not just use 8-colors for sprite-flags but ability to enter 3- or 4-character text as a unique flag. This will definitely expand the ability of recognizing unique sprites that go beyond the standard 8 flag definitions.

added 09-26-19 add char { to read only first character of variable. {"hello"="h" {false="f" {23="2" } is opposite and reads last single character

add spread() command. IE: spread(cards,52) will create an array called cards and starting with index 1 will give them a value from 1-52. a negative number will reverse the order (cards,-52), 1st index is 52.

ability to run maximum speed. that is remove all stops and run code as fast as possible where it still pauses via update() draw() flip() or yield()

give every command defaults. For instance pset() with no arguments will plot color 6 in center of screen. give defaults to every single command.

Add to PRINT ability to center text, that is, by giving the x-value a string such as "c" a flag it will automatically calculate for the center of the screen based upon the string entered. An advantage will be a string that has one or more \10 in it. It will determine the single longest line and center accordingly. Also can have "r" for right-justification.

Add new command DEBUG(pos,color,test). This will plot 1-height 8-across pixeled bars at the bottom of the screen in user chosen colors and based upon events. IE: debug(0,8,"a>0") every draw() or update() cycle will draw a red line from pixel 0 to 7 if a>0. If not, it will plot BLACK. It accounts for local variables as well as global. Can have 16 in all.

Add two new commands, varload(vars,filename) and varsave(vars,filename). The argument is: varsave("test",filename) will save off every single variable and array that starts with those 4-letters "test." If argument is "" or nil then saves off EVERY single variable that contains a value, varload() will load them back again. if filename is blank and using varsave() then it saves off to a temporary memory, if varload() with no filename will load back from that temporary memory location. No limits. Can and will save and load EVERY SINGLE variable used in a cart.

Add two new commands, bound() and wrap(). Bound does exactly what MID() does. Wrap will take a number and wrap it around IE: x=wrap(1,126) if x=0 then x will now equal 126, if x=128 then x will now equal 3. Checks for big wrap-arounds too, x=4932 and then x=wrap(1,126) it will still work and give correct results.

Add option to load/save state. This can be controlled both by the player and in the source-code. SAVESTATE(n) where n is a value from 0-9. Save with SAVESTATE(n). Literally makes a snapshot of the entire PICO system, screen and all, and saves it to temporary memory location 0-9. LOADSTATE(n) recovers state - absolutely everything EXCEPT the line number the program is running at. If no argument is chosen, 0 is selected. During execution of cart, press F2 to save state, F3 to select a state number or import/export/delete, and F4 to load state. State data is saved via users/appdata() so it is always available until removed via F3.

Option for split-screen debugging. That is the upper portion of the screen is output and lower portion is debug. In debug mode the command running is highlighted. Standard keys apple. F8 to do this command/function but stay in this local or function. F9 to enter this command/function leaving this one behind. F10 to terminate debug and stop program here returning to command mode. All during this time the coder can also enter new values for variables to see how the program reacts to it.

Turn off mouse-cursor in editor when typing. Turn it back on when physical mouse is moved or clicked. Macintosh does this by default.

Fold functions, that is, you can press F9 or F10 when on a FUNCTION() line and it will close up only showing ">" at the front to show the contents are hidden. It still leaves any lines above or below the function visible including the single FUNCTION() line itself.

Add command scramble() usage: scramble(array,key). This will randomly rearrange each of the items in the array based upon the seed of key. To scramble, use positive number key. To unscramble use negative same number key. Use 0 to choose a random number that cannot be unscrambled later, IE: scramble(cards,0). Array cards() will now have each of its items rearranged randomly.

added 09-23-19 option for two new variable types. One can have value from 0-65535 (16-bits) the other can have value from -2147483648 to 2147483647 (32-bits). If this is possible, it should also be possible to have high floating. 1E+38.

Currently CTRL+number keys (0-9) currently do nothing in editor. Suggest they jump to tabs if tabs are set in sourcecode.

Right-clicking the mouse with FILL mode in sprite editor currently just fills, same as left click. Suggest it eyedrop the color as it does in normal pen mode.

Add option to press CTRL-C during cart execution to not only stop program but jump the editor to the exact source-line where it was halted. Resume from here is available if desired.

Add new command POLYGON(), POLYGONFILL. Usage: polygon(arrayof2dpoints,color). Also OVAL(), OVALFILL(). Usage: oval(x,y,radii-x,radii-y,color).

Clear all Sprite Flags for single sprite with SHIFT-CTRL-C or some other such non-used key combination.

Change pen size with hot keys like CTRL - CTRL +. Also change edit size via CTRL , "<" smaller and CTRL "." larger. So by default you edit 8x8, press CTRL "." and then you are editing 16x16. Add CTRL "[" to decrease whole sprite page and ctrl "]" to increase whole sprite page. CTRL+P for PEN, CTRL+F for fill. Holding down left mouse button over a pixel for a short time enters selection mode. Once mouse button is released, returns to PEN mode.

added 09-22-19 option for circ() and circfill() to have arc, add argument of angle 0 to 1 or 0 to 359. IE: circ(x,y,size,color,start-angle,end-angle)

Option for rect() and rectfill() to have rounded corners, can specify depth. IE: rect(x,y,x2,y2,color,roundness intensity)

[48x8]

You can run LUA on the PSP-1000 models and higher. It should be possible to run PICO-8 as well.

There is a program to convert HTML to Android APK. It should be possible to run Pico-8 as well.

C++ can use variable++ to increase by one or variable-- to decrease by one. Suggest future PICO have this ability.

KEYCONFIG can only be used in immediate mode. If you try to run it in a cart, it only executes it when the program exits, this means of course you cannot use it at all for an EXE. Suggest copying over current key configuration to exports or allow KEYCONFIG inside someone's sourcecode.

Have ability to import or export graphic sections, not just all 256-sprites in one set.

[color=$ff0040]Have ability[/color] to change repeat speed for BUTNP(). Currently it's a tad slow. Likely others would want to change the initial delay for the first repeat and the repeat speed after. If it can be changed via source-code so much the better. setbutnp(1stkeydelay,repeatdelay)

This is pretty high-tech but would be nice to have. Once GIF is calculated via record video, maybe have a simple editor come up where you can delete individual frames (like where you are typing RUN) in the GIF before it is fully saved. I'm doing this in VirtualDUB currently, I think it could be done in PICO.

added 09-21-19 Option to turn off not just all sound but optional MUSIC() and/or sound effects. Some music is very good and some sound effects are very good, sometimes - not all at the same time. :) So there would be =2= menu options instead of just 1.

Also it has been proven through VirtualDUB that the animated GIFs you are saving via VIDEO in PICO-8 can indeed be compressed up to 97% the current size that you have. Might be worth investigating.

https://www.lexaloffle.com/bbs/?tid=35407
http://virtualdub.sourceforge.net/

Currently hitting BACKSPACE goes back a webpage even if the focus is on the P8 cart in the BBS. Hitting the TAB key also selects from the browser. This makes a text entry mode difficult. Suggest that all non-vital keys be locked and available in the cart until focus is lost. Also turn OFF all audio when clicked outside CART would be good too - or better yet just FREEZE the whole cart until it's frame is clicked again. Whereupon it continues both with sound and position - exactly where you left it.

Right-mouse-click in the sourcecode editor currently does nothing. Suggest a menu may appear. Search, Search and replace, Undo, Redo, Copy, Paste, Erase, etc.

Add a new argument to PRINT after color. Use 8-bits for each of 1 2 3 4 * 6 7 8 9 to draw outline around text. IE:

for if only the 8th bit is set:
[8x8]

for if bits 2, 4, 5, and 7 are set:
[8x8]

for if all 8 bits are set:
[8x8]

for if value is -1:
[8x8]

(it creates a full rectangle despite the character's image)

Default to color black. If additional argument chosen, that is the outline color. This also applies to sprites spr() and sspr() so sprites can also have an automatic and colored outline.

PLEASE add a grid for the sprite editor ! Or at least make it optional - easier for others to work exact pixels in the 8x8 or 16x16 area. You already have SPACEBAR in map editor show grid, can do same for sprite editor, but make it toggle ON/OFF so spacebar need not be held all the time.

NOTICED that when you export to .BIN that it uses the default keys despite me remapping the arrow keys to the number keypad. Should be able to export using user selections - or add key configure in menu (only for exports).

added 09-20-19 allow color 16 or 255 to be BXOR. That is, 15 is automatically subtracted from the color beneath the plotter thus. PSET(X,Y,16) will plot color 15 if 0 is beneath and 0 if 15 is beneath. PSET(X,Y,15-PGET(X,Y)). Same with RECT() RECTFILL() CIRC() CIRCFILL() LINE().[/color]

Also, create new command, n=BUTNW(). It will pause execution and wait for any standard joystick keypress. N will then contain a value from 0-5. If you call it without a variable in front, it will just wait for any joystick keypress but not return a value. If you enclose a value in the argument BUTNW(n) then it will wait until that very button is pressed.

A few suggestions. These should all be achievable in the current version of PICO-8.

Add 128 to colors to plot with new color and to change that palette # to use the extended if it is >=128.
PLOT(X,Y,C) rect() rectfill() line() color() print()
if C>=128 then not only does it plot the new color but directly modifies the palette for that single color index (0-15) to reflect this. Add extra argument to rect() rectfill() and line() so can plot outline around color, use 8-bit as listed above for PRINT(), also specify outline color or black by default.

pal() can now access new palette additionally. pal(original color,new color (>=128 possible),normal flag)

Create 4 new commands that do the exact same thing END does.
ENDIF
NEXT
ENDFUNCT
WEND
To help make code more readable. Obviously you could use these out of order, say ENDIF for a FOR/DO statement, but the point is to clarify readability for programmers. NEXT can have anything after it, it is ignored. Useful so you could have NEXT followed by the variable name in the FOR/DO statement.

Allow usage of number keypad arrow keys same as arrow keys in source code editor. Same with DEL and ENTER keys. Currently these are all disabled in the editor.

Every time you run your program it auto-saves your program as either the name you gave it or a default "backup" name to a backup directory.

Have an option (click-switch) to view source-code with tabs as normal or to view them as if they weren't there (source is all on one page).

Allow clipboard to be read and written to when running directly from lexaoffle. Currently it is prohibited.

Reading and writing to clipboard could be a way to save complex work as 7-bit encoded text including complex game progress passwords and custom data work if it's a type of miniature game-maker. If you're concerned about security, only permit 7-bit reading and writing of clipboard, characters #32-#126 only.

If that's not enough, limit the selection to up to 256-characters.

Never use print a value using black ink on a black background when in immediate mode typing out 'print(a)' or whatever. Instead default to color 6 if color 0 is found to be printing color. This could be configurable if someone really does want black ink on a black background by default.

Option to read off edge of screen as -1 instead of 0 (zero).
Option to read off sprite edge as -1 instead of 0 (zero).
Option to read off map edge as -1 instead of 0 (zero).

Option to read TRUE and FALSE as -1 and 0 (zero). This would help complex logic statements that involve math. I'm not the only one requesting this.

Have Fill pattern to a character not just for cross-hatch characters but ALL special icons including arrows, circle, X, etc.

Option to base all arrays starting with zero instead of forcing it via: count={[0]=0,1,2,3}

Option for PRINT with two arguments, the 2nd argument is now not X but color. New color applies if >=128

Add command to play pitch and duration bypassing need to create sound effects via table. Most early programming languages have this. SOUND(pitch,durat,type,flag) flag if TRUE means it will wait to play the full sound before continuing to run the rest of the code. ESC will always abort sound and program early. Type is instrument type. 6 being noise. If any arguments are missing, including first, defaults will be chosen. SOUND() defaults pitch, durat, type, and flag to default values.

Option to print normal text as reverse-case so if you import the string "Hello" it does not come out "hELLO" but instead correctly "Hello."

. . .

MIGHT BE COMPLEX TO DO THESE

WAIT(a,b) ... wait value of 1 means to wait 1/1000th of a second. 1000 means to wait one second. If b is TRUE then also does screen update.

INPUT, INPUTS, INPUTI, INPUTR
INPUT will allow someone to enter normal input, string only, integer only, or real value
I.E.: INPUTS(name) ... will bring up an input with optional keyboard (if Android) and let someone type in their name, accepted with CR or even spoken through microphone for cellphone, etc.

Using $ in a variable name forces it to be a string. No need for TOSTR()
Using % in a variable name forces it to be integer. No need for FLR() or CEIL()
Using # in a variable name forces it to be real. No need for TONUM()

Add new command. RAND. Rand (15) yields random integer number from 0-14. RAND(1,6) yields integer number 1-6.

SRAND(0 or a negative number) could clear the random seed and return it to normal

SORT(V,TYPE). Sorts an array. If type=FALSE sorts in reverse. If TRUE or not included sorts ascending by default. if SORT is called with no variable before it SORT(V,TYPE) instead of res=SORT(V,TYPE) then results are sorted directly into input array

New command. INSTR() to search for a string within a substring. PRINT INSTR("APPLE","PL") yields 3.
New command. RINSTR() to search for a string within a substring in reverse. PRINT INSTR("APPLE,"P") yields 3.

New command REPLACE() to replace all occurances of string within string recursively.
dessert="APPLE PIE"
chang=REPLACE(dessert,"APPLE","CHERRY")
chang now contains "CHERRY PIE"
if done without argument, just REPLACE(dessert,"APPLE,"CHERRY") then variable dessert is modified directly

New command CHAR(Str,I) to return a single character of a string, shorter version of SUB(Str,I,I)
New command MID(Str,A,B) to return a parsed string position A length of B. This is different from standard SUB()

New command FORV. This is similar to FOR/Do with the exception that the variable it uses can be manipulated and could be previously defined, for instance.

FORV I=1,10 DO
PRINT(I)
I=I+1
END

will yield: 1, 3, 5, 7, 9
After the loop it would contain 11

RECT2() to draw a rectangle where 3rd and 4th arguments are not x2 and y2 but width and height,
same with RECTFILL2()

Collision check with SPR() and other SPR() by pixel.
IF COLLISION(spr1,x,y,spr2,x,y,xtra) return FLAG of 2nd sprite, xtra means to not check pixels, just 8x8 area colliding

COLLISION2 is same but returns FLAG of 1st sprite, also xtra to not check pixels just 8x8 area colliding

IF MAPCOLLISION(spr1,x,y,xtra) where x and y are true location in map. Return value is FLAG of tile sprite if collision. Like above xtra if TRUE means to not check pixels but 8x8 area colliding.

I would really like these next ones, READTEXT() and WRITETEXT()
Read and write true text files, also higher level access directory. Can only read and write to text .TXT file for security.

mesg=READTEXT("message.txt") mesg now is a single string and contains every character from message.txt file
hisc=READLINES("hiscore.txt") hisc now has an array with as many elements as in text, one per CR delimited line. 7-bit text "@clip" is also possible.

WRITETEXT(hisc,"hiscore.txt") saves an array with as many elements in there as external text file
WRITETEXT(mesg,"message.txt") if not an array, instead saves the single string as the entire single file
7-bit text "@clip" is also possible.

next line asterisks do not appear properly, replace # with asterisk when reading
DIR(dir) where dir is a string that can contain "#.txt" to see only txt files or "#" to see every file
also use "flip#" to show every file that begins with "flip"

see=READDIR(dir) SEE now has an array with as many elements as from DIR(), one per file listed

DELETE(filename) - for safety file type can only be .TXT.

RENAME(filename1,filename2) - for safety file type can only be .TXT.

There should be no ability to delete directories. Keep it safe.

WEBSITE(url) ... loads website with default browser and opens accepted so long as URL address beginning has, "www.lexaloffle.com" to confirm staying within Lexaloffle community.

MIGHT BE VERY COMPLEX TO DO THIS

Read and write shared messages. Possible to make CHAT this way.
ANYKEY() ... is TRUE if user has pressed some key, any key, usually followed up by SEND, do not wait for key
SEND(string) sends string to everyone running this program now

ACCEPT ... is TRUE if someone has sent a message remotely and not yet been received locally, usually followed up by RECV. This is on a first-come-first-served basis. If there are several messages, it gets each of them one at a time.

RECV(string) empty until someone sends a string via ACCEPT()
For safety, strings cannot be more than 64-characters each. (256 also if you like, should set a limit though)

SIMPLE CHAT PROGRAM:

USERNAME="CHATTY CATHY"
REPEAT
  IF ANYKEY==TRUE THEN
    INPUTS(TEXT)
    SEND(USERNAME..">"..TEXT)
  END --endif
  IF ACCEPT==TRUE THEN
    RECV(OUT)
    PRINT(OUT)
  END --endif
UNTIL FOREVER - - (loop forever)
P#67574 2019-09-12 04:31 ( Edited 2022-11-14 04:58)

[ :: Read More :: ]

Cart #notabs-0 | 2019-09-11 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

Hello.

There are a few kinds of Pico-8 programmers out there. Those who like tabs and those who do not.

I fall into the latter category. So - what is the best way to remove tabs ? Well sure you can do it yourself - or you can rely on my rusty trusty Pico-8 program to do it for you !

NOTE: This program should be run NOT online but in LOCAL mode as it saves a file to your hard-drive, the corrected .P8 file called, "notabs."

Now at first I was using an index to read the string, but of course numbers only go up to 32767 so I had to use a different method. The code now will accept a program of ANY size now. Quite nice.

To use you have a few choices. If you know for instance that the code does NOT use the shift letters to create the Up, Down, Left, Right and other fancy icons in the source, you can use good old notepad.

Load up the .P8 file there. Run my program. Then copy all of the notepad contents (CTRL+A) (CTRL+C) to the clipboard. This is important to do in this order as when you first run my program it CLEARS the clipboard data first.

Right, then press CTRL-V. Press (O) to accept and after a short moment, whammo, you have a newly saved file called notabs.p8l ... be aware there is a trailing "L" on the file !

Rename to take it out and you're all set. Now if it crashes because of hitting a custom icon or arrow key, you'll have to load the original P8 in a more robust viewer like FIREFOX as an offline text file.

THEN run my program, open the P8 as a local file in Firefox.Press (CTRL+A) (CTRL+C), return to my program, press CTRL-V, and the P8 it saves should then run perfectly.

There may be an easier way to do this - but not with Pico-8 I think. :)

Any way to LOAD a text data file would be awesome, don't think that's going to happen though.

HOPE THIS HELPS !

P#67516 2019-09-11 01:12

[ :: Read More :: ]

It's the first time I'm using the PICO-8 clock. Was just experimenting.

The time of this writing is:
09-10-19 at 1:29pm.

Let me write some code to confirm this:

cls()
print("year...."..stat(80))
print("month..."..stat(81))
print("day....."..stat(82))
print("hour...."..stat(83))
print("minute.."..stat(84))
print("second.."..stat(85))
repeat
  flip()
until forever

Yet when I run this the HOUR says 18. Looking at the clock on my computer though it still says it's 1pm + 32-minutes. What gives ?

P#67487 2019-09-10 18:33 ( Edited 2019-09-10 20:13)

[ :: Read More :: ]

by dw817
Cart #tdsd-9 | 2019-09-10 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
14

UPDATES: (that's all for today 09-09-19)

bugs + changes + fixes:

  • added new picture logo

  • stepped down the difficulty and checked game to level 16
    i believe it's possible to beat it now

  • change color each new level for mission specs

  • lowered volume of giggling, yeah we had enough

  • fixed nasty bug where 2- or more would collide and fight each other for their desired location.
    now they shake hands and take off independently

  • added debug to show all activity
    you can also cheat quite thoroughly in this mode. :)

  • added display in corner to show remaining ghosts

  • fix mistyped variables, there were a few

  • allow collision with defeated ghosts (both ways)
    also move them off map just to be sure

Alrightee then !

I've been playing Little Nightmares for about a year now and am really quite fond of it.

What I wanted to do in the spirit of upcoming Halloween was a DEMAKE of the scene where the boy is in THE DEPTHS with his flashlight and must get past the evil ghost children to the next room.

What made this especially interesting is the flashlight would burn them if it was on them long enough But they also hid behind every shadow they could find in the house to avoid the light. It was quite tricky and frustrating to find them all to make it to the next room.

This demake features quite a bit of the same brain behind the Little Nightmares game. You enter a room where there are obstacles that you cannot cross (the blocks). But the ghost children can quite easily cross them with the advantage to you is you can see their silhouette when they run past them.

However when they are not on top of something solid, you cannot see them at all - except with your flashlight.

Your flashlight costs nothing and you should totally use it as much as possible. Not only is this your only weapon in the game but you can see where they are hiding.

Now the children are smart. Once the light hits them they will usually high-tail it out of there to hide somewhere else invisibly. Your best method is to try and follow their trails when they pass through solid objects and keep that beam on them till they burn up.

If you do you'll get them and you'll hear a little wail to let you know you did. Now they heal too so if the light is not on them and you have burned them. Outside the light they will recover their damage (which is pretty quickly).

Once fully recovered from damage they'll giggle and turn invisible to let you know your efforts were for naught.

If you take too long they'll really get mad and turn visible and then dive straight for you !

You start with 3 lives and you can only be hit twice by them to lose a single life. When you are hit the first time you are invulnerable for just a second - and it's up to you to get out of that dangerous situation before you are hit again.

Your player is aqua and the ghost children are ... well, they are invisible actually. You can see them as BLACK when inside the walls and they turn dark blue if on the edge of the wall. You can also see them if you are up close to them but I don't recommend it.

When the light is on them they burn orange and yellow.

But they won't stay in the walls.

If one of the children moves to the inside of the wall, they won't like it and will choose a new hiding place. It's up to you to track their movements this way.

You'll know you got them all on a level because the lights will turn on. Prepare yourself for the next level then.

The levels of difficulty increase both the number of children and the time it takes to burn them with the flashlight.

Also sometimes one of the children can become fatigued and will just sit without defending. They'll do this if they've been running around for a long time. The advantage is they don't recover their strength after this and they're fair game to your flashlight.

You gain a bonus life every 4-levels of play. How far can you make it ?

Note, there may be ERRORS in the game ! I hope not. I have really worked trying to make it so it isn't. If you come across any, please screen-capture and send to me so I can try to find out what it is.

I've testplayed this quite a bit and so far it looks pretty stable. Please let me know !

reset to level one, lives equals three

P#67442 2019-09-09 20:35 ( Edited 2019-09-10 02:53)

[ :: Read More :: ]

Surprisingly with all the updates PICO-8 has received, it has one gross error in it that took me hours to debug and later find out and break it into the exact components giving the error alone. It was definitely a case of "it's not my fault." Could cause problems later in other carts and programs.

This will not run:

if (key=="(") print"open"

This will also not run:

if (key==")") print"close"

This will run:

if (key=="[") print"open"

Wow. And no-one's discovered this till now ??

P#67302 2019-09-05 21:02 ( Edited 2019-09-06 04:08)

[ :: Read More :: ]

nhr
by dw817
Cart #nhr-4 | 2019-09-05 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6

Update: Added GRAY, bars, text, Hopalong Cassidy

Hello.

As you know, a new palette method was discovered. Now while you can't use all 32-colors in one screen (which is what I had hoped), you CAN tweak individual palettes of the 16 to use the new set.

This means for those of you who want to make games that use only one HUE, then you might find this program useful.

It shows 6-squares going from darkest but not black to each color of purple, red, orange, yellow, green, and blue, using the (O) key to change between, and the coding involved to produce it.


I have since added a picture of Hopalong Cassidy. This was not easy. First I converted a square picture of him to 128x128 B&W. Then manually created a palette based on the 7-colors that comprise of (Gray). Then reissue the image using that palette.


Then manually modify the palette only to default PICO-8 standard. Import. Re-hue, done. He looks best in the GRAY hue because that is the picture he was originally, B&W.

Would be keen to have optional 16-shades of B&W. :D Maybe next PICO-8 release.


Note, the color bars and squares are still there, change value HOPALONG=0 in the program and re-run.

P#67290 2019-09-05 17:05 ( Edited 2019-09-05 20:15)

[ :: Read More :: ]

Cart #wall_jump_platformer-4 | 2019-08-31 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

Alright, well believe it or not this would actually be the FIRST platformer I have ever written, one where you have an actual map to navigate let alone a wall-jumping sprite.

Years ago I did make some action games that worked on grids using HIRES and LORES on the Apple computer, but as I got older I wanted more and more to make turn-based thinking games relying less on human-made maps and more on computer-generated - and that is my primary focus today.

Well - this is certainly not what is happening here.

In any case, it is complete, and hopefully others can learn from the code and make good carts from it.

The first thing it does is create a sample playfield for the player to explore.

Then you have a cursor letting you place your player sprite. Use arrow keys to navigate the 64x32 area and press O to do so.

Finally you are in Testplay. Arrow keys control the player. Press O to jump and X to return to select player position.

To Wall Jump, jump then hit a wall just as you are getting ready to fall. Your player will grip the side of the wall and then fling off in the opposite direction. You can use this to climb a narrow chimney for instance.

HOPE THIS HELPS !

P#67082 2019-08-31 19:52 ( Edited 2019-08-31 20:26)

[ :: Read More :: ]

Was working on the code to randomly generate a presentable field for a platformer engine to testplay in, got to writing this code and while I won't be using it there, perhaps you can find a use for it ?

It's unusual in that it creates a maze pattern in any hollow region. Cart follows:

Cart #crazy_maze-0 | 2019-08-31 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

P#67064 2019-08-31 01:36 ( Edited 2019-08-31 01:36)

[ :: Read More :: ]

As Platformers seems to be on the tips and brains of people, I remember someone once mentioned it was difficult to make a platformer. If you have a reasonable background in math, I think it can be done fairly easily.

Here then is my sample engine to demonstrate how it can be done. I have geared this particular engine to match as closely as I can Nintendo's own Super Mario Bros game without using look-up tables.

Cart #kinezapubo-0 | 2019-08-30 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

Keys are LEFT, RIGHT, and (O) to jump.

Note also I am multiplying everything by 100. The reason is simple. Most programming languages start to give incorrect values even doing simple things like subtracting .1 or .05 from a real number. By keeping everything integer, you do not have problems with the limitations of the language's inability to handle real numbers.

From here also it should be possible to make a simple platformer that detects walls, surfaces, and even allow the famous Wall-Jump where you jump from wall to wall to climb an area.

HOPE THIS HELPS !

P#67045 2019-08-30 18:21 ( Edited 2019-08-30 18:22)

[ :: Read More :: ]

Cart #gojefesozi-0 | 2019-08-24 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

You may have seen a few rare carts read the keyboard. I wrote this simple program to demonstrate easily how it can be done.

It also introduces two useful functions of CHR() and ASC() where CHR(n) returns the character equivalent from an ASCII value N whereas ASC(n) returns the ASCII equivalent from the character N.

It is important to note that I have reversed the values of 65-90 and 97-122 respectively as in PICO-8, pressing "A" by itself normally gives 97 despite its appearance being uppercase.

You are welcome to change the table back if you like.

If you don't want to use BTNP() or BTN() to return your arrow keys, you can hit NUM-LOCK and use "2" "4" "6" and "8" respectively to emulate arrow motions. Additionally, "1" "3" "7" and "9" for single stroke diagonals !

This keyboard routine does not read the regular arrow keys nor PgDn, PgUp, Home, End, Ins, Del, Shift, Ctrl, Alt, Caps Lock, or any of the function keys. Nor will it read extended keys such as CTRL followed by a character or ALT followed by a character.

It does however read every remaining key including shift keys A-Z to return the extended set past 126 and Tab, Backspace, Enter, and Spacebar. This does include letter "P" as returnable as in the code I have disabled it.

For this demo, however, You can press "!" to pause this cart to show it can be invoked and the code explains how it is done.

HOPE THIS HELPS !

P#66902 2019-08-24 03:50 ( Edited 2019-08-24 04:45)

[ :: Read More :: ]
function wait()
  repeat
    flip()
  until btnp(4)
end

function count()
  cls()
  for i=1,3 do
    print(i)
  end
end

i=6

count()

wait()

print("")
print(i)
print("")

wait()

for i=1,3 do
  print(i)
end

wait()

print("")
print(i)
print("done!")

repeat
  flip()
until forever

By looking at this code you would think the end result would be 4 each time, both in the function and in the main program as most programming languages would return that value. But this is not the case with PICO-8. Instead the result will be what you defined globally, in this case 6.

So it's important to remember that the index variable in ANY FOR/END statements, either directly in your main code or in a function - will ALWAYS be local to the loop.

So you need NEVER define LOCAL variables in a function that will only be used in FOR/END statements. Good to know.

Here is the cart for examination:

Cart #mifehifiwi-0 | 2019-08-22 | Code ▽ | Embed ▽ | No License

P#66867 2019-08-22 20:57 ( Edited 2019-08-22 21:03)

[ :: Read More :: ]

Cart #higininufo-0 | 2019-08-22 | Code ▽ | Embed ▽ | No License
1

While I have seen the ATARI 2600 do this several times to save on space, it's a shame that PICO-8 does not have a scaling function for the default 3x5 font. In the original Haunted House or "Mildew's Manor" game, I made use of this double-size method in the menu.

Here now you can have it to use in your own code. See demo enclosed.

HOPE THIS HELPS !

P#66866 2019-08-22 20:42 ( Edited 2019-08-22 21:00)

[ :: Read More :: ]

Cart #jiyiyarodo-0 | 2019-08-21 | Code ▽ | Embed ▽ | No License
2

While I don't think PICO-8 has any appreciable VSYNC ability, you can indeed make use of this rare command to stop the screen from tearing when updating massive pixels as seen here:

If the HoldFrame flag is off, in immediate mode (and possibly not from a browser execution) my screen gets a wiggly line about 3/4 of the way down the screen when doing this update.

If you invoke the seldom used command HOLDFRAME() however, you can prevent against this for games played as an EXE or in immediate mode. Check the source for details.

HOPE THIS HELPS !

P#66821 2019-08-21 02:45 ( Edited 2019-08-21 02:47)

[ :: Read More :: ]

Cart #wijagabufi-0 | 2019-08-18 | Code ▽ | Embed ▽ | No License
1

I was reading earlier about the Fisher-Yates Shuffle method and - well, I'm a little confused. What is the purpose of its complexity ?

I mean if you just want to shuffle a deck of cards, for instance, you can do so in code as simple as this:

-- simple card shuffler
-- written by dw817

-- initialize variables
deck={}
rank="a23456789tjqk"
suit="schd"

-- build sorted deck
for i=0,3 do
  for j=0,12 do
    deck[j+i*13]=sub(rank,j+1,j+1)..sub(suit,i+1,i+1)
  end
end

::again::

-- display current deck
cls()
for i=0,3 do
  for j=0,12 do
    print(deck[j+i*13],j*10,i*8,13)
  end
end
print("press a key to shuffle",0,64,7)

repeat
  flip()
until btnp(🅾️)

-- shuffle that deck
for i=0,51 do
  r=flr(rnd()*52)
  deck[i],deck[r]=deck[r],deck[i]
end

goto again

In the Fisher-Yates method you are expected to use a technique that involves saving every single element that was chosen so it will not be chosen again.

What if any are the advantages of using a shuffle such as this based on a simple single-array index-swap as seen above ?

Failing that, what is YOUR method for shuffling items in an array that satisfy you they are properly scrambled ?

P#66748 2019-08-18 00:21 ( Edited 2019-08-18 00:23)

[ :: Read More :: ]

I was curious to know if it was possible to recode the key to pause a cart during runtime. That is, directly in the source-code itself.

If you go to make a program that asks your name and reads the real keyboard via poke 24365,1, if you hit letter "P" it will pause with an interrupt menu. Is there some way, in code, poke or otherwise, to reconfigure the pause key to something like "ESC" or backwards apostrophe "`" ?

How can this be done ?

P#66733 2019-08-17 17:25

[ :: Read More :: ]

Cart #paziwerize-0 | 2019-08-13 | Code ▽ | Embed ▽ | No License

While there is no true PCOPY() command yet for Pico-8, you can certainly simulate having 3-extra virtual pages that will cost you no tiles, no mapper, and even no array space - if you are content to use the resolution of 64x64. In this two new commands are introduced. PCOPY() which will copy a page number from 0 to 3 back to a different page number 0 to 3 where zero is the display page.

It uses MEMCPY() so it should be fast enough.
Changed to use PGET() as apparently memcpy() does not work incrementally.

Doing so you can create images on the other three pages and recall them anytime you want.

You plot pixels using the PST() command where the first argument is page # (0-3), then x-coordinate, then y-coordinate, then color.

And there you have it !

See sourcecode for details. (Added debug option to see all activity)

HOPE THIS HELPS !

P#66653 2019-08-13 18:34 ( Edited 2019-08-13 19:18)

[ :: Read More :: ]

Cart #wadesupuso-0 | 2019-08-10 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

If you want to be able to record the screen and use it as a static image for your games, you can do so fairly easily as long as you don't need more than 128- 8x8 graphic characters and don't need the mapper space at all.

With this out of the way you can use

memcpy(4096,24576,8192)

to record the screen, and

memcpy(24576,4096,8192)

to recover the screen. See the source code for the cart above for the code to do so.

This is useful if you are doing more than just a few simple images that can be redrawn, especially if they are elements that are randomly placed. Using memcpy() will be a lot faster and not require you to use arrays to redraw everything exactly like it was. You might even be able to use this method in your current and future projects.

Now I remember QBasic had this good command called PCOPY() which would page copy any graphics you had up to 16-pages via a number 0-15 so it would be

PCOPY(orig,dest)

. Perhaps in the future PICO-8 will have this ability ?

HOPE THIS HELPS !

P#66525 2019-08-10 23:26 ( Edited 2019-08-10 23:28)

[ :: Read More :: ]

Cart #simple_mouse-0 | 2019-08-01 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6

For those learning PICO-8, you may have heard that you can write carts that access the hardware mouse. While the information to do this is not readily apparent, I put together this simple demonstration program with remarks to show how you can do it by reading the position and both buttons of the device.

-- simple introduction to
-- using stat(32,33,34)
-- for reading the mouse
-- by dw817 -- (08-01-19)
--
-- poke(24365,1)
-- enables keyboard + mouse
--
-- stat(32) mouse-x position
-- stat(33) mouse-y position
-- stat(34) =1 if left button
-- stat(34) =2 if right button
-- stat(34) =3 both buttons
--
-- flip() updates the screen

cls()
poke(24365,1) -- enable mouse

c=7
repeat
  color(7)

-- if right-button pressed,
-- change plotting color

  if stat(34)==2 then
    c=c+1
    if (c==16) c=1

-- if both buttons pressed,
-- clear the screen

  elseif stat(34)==3 then
    cls()
  end

-- read x+y position of mouse

  x=stat(32) y=stat(33)

-- if left button pressed,
-- draw on screen

  if stat(34)==1 then
    if ox!=nil then
      line(ox,oy,x,y,c)
    end
    ox=x oy=y
  else
    ox=nil
  end

  p=pget(x,y)
  pset(x,y,c)
  flip()
  pset(x,y,p)

-- loop until press [esc]

until forever

Those who want to reword this OOPS are welcome to.

Hope This Helps !

P#66295 2019-08-01 20:09 ( Edited 2019-08-01 20:12)

[ :: Read More :: ]

For you new people at PICO-8 and even some of you veterans, you may or may not be aware that you can create a BATCH file to run PICO-8 with very precise settings. Here is the one I use:

CONTENTS OF P8.BAT

@run-pico8.exe -gif_len 120 -windowed 1 -width 692 -height 650 -draw_rect 10,5,672,640 -sound 64 -music 64 -pixel_perfect 0 -software_blit 1 -desktop c:\david\games\pico-8\pico-8_win32\roms\_snaps -home c:\david\games\pico-8\pico-8_win32

You can use this as a SHORTCUT too but it is too long, I think a Windows shortcut only allows 64-characters. So if you can, a BATCH file will work just as well.

Modify to your liking and - Hope This Helps !

P#66252 2019-07-31 18:45

[ :: Read More :: ]

Cart #fast_256_colors-0 | 2019-07-31 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
5

-- 256-colors rehashed
-- i think this is as fast as
-- i can get the code.
-- you will notice that the
-- loop only moves a section
-- of memory per frame now.

mode=0
p=0
cls()

function _update60()
  p=1-p
  if mode==0 or mode==1 then
    sfx(0) -- confirm drawing
    fillp(23130)
    if(p>0)fillp(-23131)
    for i=0,15 do
      for j=0,7 do
       rectfill(i*8,j*8,i*8+7,j*8+7,i+j*16)
      end
    end
    if mode==0 then
      memcpy(0,24576,4096)
      mode=1
    elseif mode==1 then
      memcpy(4096,24576,4096)
      mode=2
    end
  else
    if p==0 then
      memcpy(24576,0,4096)
    else
      memcpy(24576,4096,4096)
    end
  end
end

This is a puzzle. If you let it run for about 10-seconds, it DOES clear up and show you a near flawless 256-colors using memory swap of two half-screens - but it doesn't stay. After another 10-seconds it garbles, then fixes itself again. But does not stay.

I had hoped by removing the loop for redrawing the colors and writing a loop of memory moves only would speed it up, but apparently it still can't perfectly synchronize.

I noticed online (running in an internet window) it seems to run better with less flicker, so something good is happening there.

Can some Coding Wizard figure out how to get this to run flawlessly (in IDE and as EXE) each time with no period of it messing up ? I think this could be of use to others as it would mean more colors for opening logos to PICO-8 carts.

P#66233 2019-07-31 03:56 ( Edited 2019-07-31 03:59)

View Older Posts